const express = require('express')
const app = express()
const appRouter = require('./routes')
const CORS = require('cors')
const { httpServer } = require('./webSocket')

app.use(express.json())
app.use(express.urlencoded({ extended: false }))
app.use(CORS())
app.use('/static', express.static('./static'))//这里路径不能直接使用"/"开头
app.use('/api', appRouter)
app.listen(8080, () => { console.log('请访问http://localhost:8080') })
httpServer.listen(4000, () => { console.log('webSocket地址http://localhost:4000') })//浏览器webSocket请求地址
